package org.chen.controller;

import lombok.extern.slf4j.Slf4j;
import org.chen.domain.dto.VideoCallbackDTO;
import org.chen.domain.response.Result;
import org.chen.service.VideoTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/callback")
@Slf4j
public class CallbackController {
    
    @Autowired
    private VideoTaskService videoTaskService;
    
    @PostMapping("/video")
    public Result<Void> handleVideoCallback(@RequestBody VideoCallbackDTO callback) {
        log.info("Received video callback: {}", callback);
        videoTaskService.handleCallback(callback);
        return Result.success();
    }
}